import { useEffect, useState } from "react";
// 导入供应列表请求
import { supplier_list, requirent_list, shopping_list,credit_list } from '../../tools/lhq/api'

// 供应列表
export function useSupplier(){
    var [supplier, setSupplier] = useState([])
    // 发请求 获取供应列表
    useEffect(() => {
        supplier_list().then((res) => {
            setSupplier(res.data)
        })
    }, [])
    return [supplier, setSupplier];
}
// 请购单列表
export function useRequirent() {
    var [requirent, setRequirent] = useState([])
    // 发请求 获取供应列表
    useEffect(() => {
        requirent_list().then((res) => {
            setRequirent(res.data)
        })
    }, [])
    return [requirent, setRequirent];
}
// 采购单列表
export function useShopping() {
    var [shopping, setShopping] = useState([])
    // 发请求 获取供应列表
    useEffect(() => {
        shopping_list().then((res) => {
            setShopping(res.data)
        })
    }, [])
    return [shopping, setShopping];
}
// 退货单列表
export function useCredit() {
    var [credit, setCredit] = useState([])
    // 发请求 获取供应列表
    useEffect(() => {
        credit_list().then((res) => {
            setCredit(res.data)
        })
    }, [])
    return [credit, setCredit];
}
